Shift-click or double-click on a critter to see and/or edit its characteristics.
Option-click on a critter to kill it.
Shift-Option-drag to create a “Garden of Eden.” (extra food)
Shift-Command-drag to create a “Desert” (no food)
The Caps Lock key stops the action, the Space bar single steps while stopped.
Changes since 0.2
This is only a partial list, but I’ll try to hit the highlights:
•You can save your worlds (I know, I know, it’s about time . . .).
•The same version works on both black and white and color Macs.
•Critters and the sun can wrap around if you like (you know, toroidal world).
•There are new genes that affect breeding.
•There are new movement genes.
•There is a user-settable “wind” that blows.
•You can drag out a “desert” where no food will grow.
•You can link the sun, the garden, the desert, and the mouse together in various ways.
•You can select the pattern of food growth.
•You can select which genes are allowed to mutate.
•Each critter has a four character family name that can you can use to trace ancestry.
•There is a “go fast” mode that shrinks the window to an icon, for long runs.
Overview
EVOLV-O-MATIC is an evolution simulation. The basic idea is this: if there are things that reproduce themselves with small random variations; if these variations can sometimes confer a survival advantage on their owners; and if there is competition between the reproducing entities for some necessary and limited resource; then the entities will get better at reproducing themselves over time. This happens automatically: the breeding stock cannot help but improve.
There is a population of small simulated critters living in a window on the screen. The critters’ world is a flat white grazing field peppered with black food pixels. Like manna falling from the sky, the food just sort of appears in a semi-random distribution. The critters don’t notice the food unless it is right under their little virtual noses, in which case it is consumed immediately. Each food particle eaten adds a certain number of energy units to the critter, which it uses to live, move, and reproduce. If a critter's energy falls to zero, it dies.
Each critter has a set of “genes” which determine its movement patterns and its breeding behavior. Some of a critter’s genes control its response to the “sun” that can move around in the world: a critter can be attracted or repelled, excited or calmed by light, and each critter has a “soft side,”or sensitive side, which it may try to keep towards or away from the light. Combinations of these factors lead to interesting behaviors: orbiting, sun humping, scouting, slingshooting, etc.
Other genes control a critter's “litter size” and the necessary circumstances for it to reproduce. A critter will divide—creating some number of descendants—if it lives long enough and stores up enough food energy. Each descendant is mutated slightly: it is an imperfect copy of its “mother,” who lives on to make more mutant daughters. The mutation may or may not be beneficial to the baby critter; if it is, the critter has a better chance of reproducing itself, thus propagating its genes through the population. Little by little, the population becomes “tuned” to the environment (at least in theory).
Genetic Details
A critter’s genetic information is a set of fifteen integers between -15 and 15. For the most part, only magnitude is used: negative values have no meaning (exceptions are noted below).
The first 8 genes are the basic movement genes: they can be thought of as probabilities that the critter will turn in a particular direction relative to its current heading. During each program cycle a random number is generated which, after suitable mathematical manipulations, is used to pick the new direction for the critter, based on the movement genes. However, two other genes also have a role in picking the new direction (see below).
The next 3 genes are the “sun” genes. The first of these is a speed gene (SPD): a positive value means a critter will speed up under the influence of the sun, while a negative value says it will slow down and even stop. Zero means the critter doesn't change its speed at all in response to light.
Next is the directional gene (DIR). This one determines whether a critter is attracted (positive) or repelled (negative) by the sun. A critter with a strong positive value here will dive straight for the sun, and indeed will attempt to keep itself inside the sun. This is affectionately known as “sun humping.”
The last of the light response genes is the “softside” gene (SSD). Each critter has a particular direction (relative to itself) that can be thought of as sensitive (this direction is a critter constant: it is not subject to mutation--the only way it changes is if you muck with it). The gene value determines whether the bug likes to keep its softside towards the sun (positive) or away from the sun (negative). This gene can result in fairly complex paths. A critter with a strong positive gene value and an “East” softside will try to orbit the sun clockwise; if its softside is NW, the critter will spiral in towards the sun counterclockwise; etc. Note that a critter with a strong positive gene value is equivalent to one that has a strong negative value and an opposite soft side.
Like the basic movement genes, a negative value in the next four genes is meaningless: only magnitude is used:
The next gene (MSS) represents a critter's “mass” or “inertia.” Think of the critters as moving through a viscous fluid that exerts a drag on them. This gene represents a critter's “streamlinedness.” Once a critter takes off in a certain direction at a certain speed, it coasts until its velocity reaches zero. Only then can it pick a new direction and speed. A value of zero means “infinite drag,” so it picks a new direction and speed every turn (identical to the older versions of the program).
Next are the three breeding genes. The first (AGE) determines how old a critter must be to reproduce, in units of “fifteenths of the Max. Age” (the Max. Age is settable by you). The next (STR) determines the minimum energy store (strength) a critter must have to reproduce, in units of “fifteenths of the Max Strength” (also settable). The final gene (OFF) is the critter's litter size: how many offspring it produces. When a critter breeds, its strength is evenly divided among its daughters.
There is one more gene (you’ll see it in the dialogs) that is present but is not used in this version of the program (or any version for that matter). This is the EYE gene, which determines how far away a critter can see another critter. This is a newly added gene that will allow much greater complexity in the simulation, but I haven’t gotten around to actually using it yet (this is, after all, a spare time pursuit--maybe someday). If you want to see the critters seeing each other, launch the program while holding the mouse button down. When you get tired of the mess, just quit and start again.
How To Use EVOLV-O-MATIC
There are some non-obvious (in fact downright obscured) functions you need to know about first. I went a little wild with the modifier keys, sorry:
Shift-click or double-click on a critter to see and/or edit its characteristics.
Option-click on a critter to kill it.
Shift-Option-drag to create a “Garden of Eden.” (extra food)
Shift-Command-drag to create a “Desert” (no food)
The Caps Lock key stops the action, the Space bar single steps while stopped.
The Critter Dialog
Shift-clicking or double-clicking a critter brings up a dialog box that lets you view and change all the attributes of that critter.
Movement Genes are shown, in the directions they represent, around a decorative bug. You can adjust these genes to change a critter’s probability of moving a particular direction. See “Genetic Details” above for more info. Legal values are 0 to 15.
Softside: Here’s another obscured feature for you. See the little arrows around the beetle in the dialog? One of them has a dot in it. That side of the critter is its softside. It can be changed by clicking on the arrow you want.
Other Genes are the rest of a critter’s genes. Pardon the obscure three letter codes; space is precious. See “Genetic Details” above for more info on the individual genes. Legal values are
-15 to 15.
Family Stuff: Here are the Family name–a four letter name assigned randomly (you can change it to whatever you want, of course)–and the color button, which lets you pick the bug color. These two attributes, along with a critter’s softside, are constant and are handed down unmodified to descendants.
Other: Age is the critter’s current age in cycles. Strength is the critter’s current energy store. Direction is the critter’s current global heading as an integer from 0 to 7 (North at 0 counting clockwise). Speed is the critter’s current speed.
The Setup Menu
The rest of the simulation parameters are viewed and changed through more dialog boxes (I hope the Human Interface gods will forgive me, but it’s the fastest way to slap in new stuff. I did try to make ‘em pretty...). The “Setup” menu is how you get at them. Here is each dialog in turn:
Sun... Dialog
Strength is the intensity of the sunlight, in contrived units. The “light” the critters see is inversely proportional to the distance from the sun squared, just like light in real life. Set this to zero to turn the sun off completely. Legal values are 0 to 5000.
Speed is the velocity of the sun, in pixels per cycle. Set it to 0 for a stationary sun.
Direction is the current direction of sun travel: legal values are 0 through 7, with 0 being north or up, and the rest numbered consecutively clockwise.
If Wrap-around is checked, the sun will “wrap” around when it reaches the edge of the world, otherwise it bounces off the edge. When it bounces it always turns right 135°.
Food... Dialog
Growth rate is the number of food pixels that get dropped on the world each cycle. Note that the food will be thinner in a bigger world if the rate is the same.
Garden rate is the same as the food growth rate, but the food is confined to the current “Garden of Eden” (formed by holding down the shift and option keys and dragging out a rectangle). Note that a larger rectangle makes a less “dense” garden.
Energy Content is the number of “energy units” that one food pixel contains. This number is added to a critter’s stomach, or energy storage, for each pixel it consumes. Energy is used by the critter to live, move, and reproduce.
Click Growth Pattern to change the pattern of food growth. You’ll get another dialog that lets you pick the distribution of food growth in the world. Click the “uniform” button for a uniform distribution, click just outside the box to get a linear fade in one dimension, or click in the box to center food growth on a point.
Bugs... Dialog
Maximum Age is the age at which critters will die from frustration. (Age is measured in cycles. Each critter gets to move, eat, and maybe spawn each cycle.)
Maximum Strength is the size of a critter’s “stomach,” i.e. the maximum number of energy units a critter can store.
Top Speed is the maximum number of pixels a critter can travel in one move.
If Fast Turns is checked, critters can change direction immediately. This tends to result in a jittery sort of bug. With this item unchecked, a critter can only turn right or left one notch at a time, so the movement is smoother, more sweeping. (One of the quickest ways to see something tangible evolve is to turn off the sun and check this item, then start over. Usually within five minutes you can see critters evolving a tendency to move forward).
If Always Moving is checked, critters can never stop, they always move at least one pixel per cycle.
If Dead Bugs -> Food is checked, a critter that dies leaves a little splot of food behind, otherwise it just vanishes.
If Wrap-around is checked, the critters will will wrap around when they reach the edge of the window, otherwise they bounce off the edges.
World... Dialog
Maximum Population is what you think it is. If the population of critters reaches this value, none can reproduce until some die. Legal values are from 1 to 100. (Someday maybe I’ll make the maximum depend on available memory, but the program is so slow with more than about 50 critters it hardly seems worth it.)
Minimum Population is the number of critters below which the program will start adding new, randomly generated bugs.
Horizontal Wind is the number of pixels per cycle that a critter is moved automatically to the right. Negative numbers go left.
Vertical Wind is the number of pixels per cycle that a critter is moved automatically down. Negative numbers go up.
Mutation rate is the amount a gene will change during a mutation. Randomly chosen genes in each new descendant are either increased or decreased by this amount. Legal values are 0 to 15.
# of Mutations is the number of genes that are subject to mutation in a new descendant. Legal values are 0 to 16.
The Sounds check box turns sound on and off. This is a silly feature: there is a sound for birth and one for death that will play at the appropriate times. You can use ResEdit (if you know how) to install your own sounds. There must be one named “Birth” and one named “Death” for this box to be enabled.
The Links... button brings up a dialog that lets you link the sun, the garden of eden, the desert, and the mouse together in various ways. For instance, you can link the garden to the sun to make a kind of fake photosynthesis: bugs that stay close to the sun will get more food. Both the Garden and the Desert can be linked to either the sun or the mouse. Additionally, the sun can be linked to the mouse.
Here’s something fun to try: when you are about to do some work on the computer for a while, especially if you are going to be using the mouse a lot, drag out a smallish Garden of Eden, link it to the sun and to the mouse, turn food off (by entering a zero in the Growth Rate box), and put the program in the background. Work for a while. You should see the bugs evolving to stay close to the sun.
Genes... Dialog
This dialog lets you control two things: the initial values of genes for newly created critters, and which genes are subject to mutation. Entering a number into the text box for a gene makes newly created bugs have that value for that gene. Entering an “R” or “r” means that new bugs will use a random number for that gene. If the checkbox is checked, then that gene is allowed to mutate.
The Rest of the Setup menu
Use Defaults sets all the parameters to their initial, default values.
Start Over kills all critters, redistributes the food from scratch, and starts again, without changing any simulation parameters. This is useful after you have changed around the parameters of the simulation in preparation for a new run.
Add New Critter creates a new, randomly generated critter. You have to look close to see anything happen.
Show statistics shows a small window that displays the current population size, the age of the world, and a bar graph of the average gene values over the entire population. For efficiency, this window only recalculates when a critter dies or is born, or if you click in it.
Go Fast collapses the window to a little icon that only shows you the age of the world. The graphics take up much of the time in this program, so not drawing speeds things up considerably. Double-click on the icon or select the menu item again to expand it back to normal.
General Comments
I’m still not sure whether EVOLV-O-MATIC is a toy or a tool. First I thought it was one, then another; so it ended up being a strange amalgam of both. As a game, its charm is short-lived, although it’s fun to watch in the way an aquarium is fun to watch, and there are enough parameters to allow a lot of exploration. As a tool, it lacks many necessary amenities–most particularly a history recording mechanism–and it is not deeply configurable. Treat it however you like. If you have any interesting results, I’d love to hear about them.
Credits
This program was originally inspired by the Computer Recreations column in the May, 1989 issue of Scientific American. Other inspirational sources are “Vehicles: Experiments in Synthetic Psychology” by Valentino Braitenberg, “Artificial Life” edited by Chris Langton, “The Blind Watchmaker” by Richard Dawkins, and many others too numerous to mention. Watch for future versions: More Complexity! More Genes! Morphogenesis! Photosynthesis! Speciation! Predators! Sex!
I would welcome comments, suggestions, ideas, conversations, bug reports, candy, toys, or money. AppleLink: JOHNSON.DK, Internet: dkj@apple.com, America Online: Silverfish, Compuserve: 75300,715,√∫write to 58 Chenery Street, San Francisco, CA 94131.
Many thanks to Matthew MacLaurin, Bryan "Beaker" Ressler, and Ned van Alstyne for enthusiasm and great ideas in the beginning; to some of the people who gave me feedback on version 0.2 (many of the new features were suggested by them): Chris Allen, Tom O'Brien, Eric Ziemer, and Scott Burgess; and of course to Lisa for letting me get away with it.